"""
from multiprocessing import Process
import time
import os

class Process_class(Process):
    def __init__(self,interval):
        Process.__init__(self)
        self.interval = interval

    def run(self):
        print(f"子进程：{os.getpid()}开始执行，父进程为：{os.getppid()}")
        t_start = time.time()
        time.sleep(self.interval)
        t_stop = time.time()
        print(f"{os.getpid()}执行结束，耗时{t_stop-t_start}秒")

if __name__ == "__main__":
    t_start = time.time()
    print(f"当前进程程序：{os.getpid()}")
    p1 = Process_class(2)
    p1.start()
    p1.join()
    t_stop = time.time()
    print("共耗时：{}".format(t_stop-t_start))

"""

from multiprocessing import Process
import time

class MyNewProcess(Process):
    def __init__(self):
        Process.__init__(self)

    def run(self):
        while True:
            print("____1____")
            time.sleep(1)
if __name__ == '__main__':

    p =MyNewProcess()
    p.start()
    while True:
        print("main")
        time.sleep(1)
